Convex Two-Layer Modeling with Latent Structure