In either park, it's a 10-15 minute walk from the furthest corner back up to the front gate. In IOA, Hogwarts is the furthest corner, while in USF it's the Fear Factor experience (but Diagon Alley is pretty close to that corner of the park.) We found that if the wait for the Hogwarts Express was more than about 15 minutes, it was faster to walk from one Wizarding World to the other.
Obviously this is contingent on your walking speed (me and my kids walk about 3 mph) and the crowd levels. Special events like the parade will also slow this down considerably.
The most direct way to get from Hogsmeade to Diagon Alley (and vice versa) is to take the Hogwarts Express. It is a very enjoyable ride and is a different show riding each way.
That said, to use it requires you have a park-to-park ticket. You will go through a ticket booth which is actually an entrance gate to the park you are hopping to.
There is no walking path other than going out the front gate, walk across in front of Hard Rock Cafe and enter at next park front gate.
We found that if the wait for the Hogwarts Express was more than about 15 minutes, it was faster to walk from one Wizarding World to the other..