Your way forward, for best results, I think is to use quaternions - although other members may have a better idea.
Quats will allow you to mathematically do the conversion you need. But pay attention to rotation orders in your results!
Although it's best to try to understand them as much as possible, you don't need to completely understand quats (nobody can really think in 4 dimensions), just how to use them. Understanding = difficult. Using = easy. Depending on your development environment / language, you may be able to find a simple to use, well documented quaternion math library.
Good luck!
- Davedub