The "xml-to-pdf" part can be achieved using the Apache FOP library if you're proficient in XSL-FO. If the XML is closer to XHTML, the Flying Saucer library may help (it's on dev.java.net).
The "vice versa" part will be hard, if not impossible. You may be able to extract the text that's in the pdf using a librariy like PDFBox or JPedal, but that text will be unstructured. So it'd be up to your application to create XML from that.