Training Deep and Recurrent Neural Networks with Hessian-Free Optimization