Do you want a NEW visualization or do you want to use an existing visualization and change out the data? If you want a new visualization, then no, there is no good way to do it without handcrafting your own xml for the .twb, which is not realistic. If you have an existing .twbx, you can download it and unzip it (twbx is just a .zip file) and swap out the old TDE for the new TDE. You can do that in whatever code you want.
Hope that helps.