Can I do this conversion with any programming language or library?
The short answer is yes, it can be done in any programming language.
Basic steps:
Some web sites to help you get started:
June 2015 Note: The epubcheck validator has moved from google code to GitHub; note the new URL.