If you don't have early entry, go to the park that doesn't have early entry first! Usually Hogsmeade has early entry. In that case you'd go to Diagon first, be there before the park opens so you're some of the first to get in when it does. And do Gringotts first. That'll be the shortest the line will be until the end of the day. After the ride I enjoy the area. Shopping, butterbeer ice cream, Ollivanders, etc. then take the train over to the other land and hope the line has died down during lunch hour.
The official website lists which park has early entry on the hours page. If you were to go to the one with early entry first the Potter ride will already have a long line from the hotel guests that got there before the park opens.
Just noticed this comment.. Resort guests will also ride Hogwarts Express to the second park as it is opening. Only way to beat them is to join them.