A Unified Cognitive Learning Framework for Adapting to Dynamic Environment and Tasks