In fact, you can change your companion's class -- within limits.
Most (if not all) companions have multiple stances, for instance tanking or dps stance, or healing or dps. Open your companion's skill bar (I use ~, not sure if that's the default hotkey) and click the stance you want to use. Furthermore, by right-clicking, you can toggle which abilities you want him to use in combat.
For instance, I can make my Trooper's ranged tank function as a dps by changing his "generate more threat" stance to "do more damage" and by deactivating his threat generating abilities. Of course, since he'll be using only a few of his skills now, he won't perform as good as my real dps companions. But it's a nice workaround if you haven't unlocked all your companions yet.