It's possible, but not recommended. You have many things going against you.
1. The OS is unsupported, even from Boot Camp. This doesn't mean it won't install or work, but it does mean if you run into trouble installing (or activating) your software SolidWorks will not be able to help you.
2. The two machines that you have listed are not running supported graphics cards. Supported cards are cards from the ATI FirePro, FireGL series or the Nvidia Quadro, Quadro FX series. ATI Radeon and Nvidia Geforce cards are not supported. I couldn't find a package on the apple site that included a supported card.
3. If you do happen to find an apple with a supported gpu, you have to make sure that your VM software supports OpenGL Hardware Acceleration. If it does not, you might as well not have a supported card.
Running an unsupported card is a big deal. It can cause graphics issues ranging from small annoyances such as a random fillet feature jumping out into space, to more serious issues such as your part geometry being completely invisible the inability to select edges, faces, etc.
If it were my money, I would steer very clear.