Flexible Modeling of Latent Task Structures in Multitask Learning