Nonlinear magnetohydrodynamics from gravity