Converting wav to midi is non-trivial, though an area with a lot of research. There is some success in limited situations, but no complete solution yet.
Converting midi to wav is a different matter. You can normally always do it by recording the midi as it plays, but this has to be done in real time. However there are programs that can realize the midi directly to wav without playing it. Essentially they simulate the midi synthesis and just save the wav output rather than playing it. The advantage of this is that it's much faster than playing the midi in real time. The disadvantage is that you're limited by the type of midi synthesiser available to the program.
There is fuller discussion of these topics in other thread, such as the ones George lists above.