Data-Driven Learning And Optimization Of Dynamical Systems