There is no law that prohibits an F-1, J-1, F-2, or J-2 visa holder from applying for a green card directly. But as a practical matter it takes a long time to obtain a green card in most cases. Therefore, even if you begin your green card process while you are on F or J status you will probably be required to convert to H-1 due to lack of time. Conversion to H-1 during green card pendency is no problem.
One more issue that you have to bear in mind is that F and J visas do not allow you to possess immigrant intent. Therefore, if you travel abroad during the pendency of the green card or if you need to obtain F or J visa stamped, you could have trouble because filing for green card you would have established immigrant intent.