Zero-Shot Skill Composition and Simulation-to-Real Transfer by Learning Task Representations