With electronics on both ends, the devices could easily negotiate in which direction power should flow, how much, and detect open and short conditions.
So, tell us how you expect this task would be achieved. (I know some possible ways, but I could just as easily say "but none are as effective as using the right cable for the task!")