Translating between Scientific Computing and Machine Learning with Automatic Differentiation