Once you get the DWG, you can use ENTGET to transform an entity in a list of DXF codes. Yes, you could walk in the AutoCAD's database and transform the entities one by one. But probable you should include the nongraphic entities too. Say if a line must be placed on an inexistent layer, AutoCAD will create that layer "on the fly". But you must deal with text styles, dimstyles and so on. Also if there are inserts, you must define the blocks first. About the Xrefs -better don't even mention it.
To make the long story short: in theory it's possible, for some drawings it is easier, for other ones is more complicated.