Multi-task Learning for Heterogeneous Data via Integrating Shared and Task-Specific Encodings