It's not hard at all, but does take a bit of time. The best way, I think, is to take a cab from the ship to Red Hook, and then catch the ferry to St. John. The cab ride takes about 20-30 minutes, then the ferry takes about 20 minutes. The stop on St. John is at Cruz Bay, which is about a 10-15 minute cab ride from Trunk Bay. The ferry is $3/person ($1 for kids).
There is also a ferry from downtown Charlotte Amalie to Cruz Bay, but it doesn't run as often and is more expensive.
If you're going to do a beach day on St. John, try to be among the first people off the ship as soon as it's cleared by Immigration. That way, you have a good chance to make the 9:00am ferry at Red Hook. The ferries run hourly, on the hour, so if you miss the 9 o'clock, you have to wait until 10. To get back to the ship on time, you have to catch the 3:00pm ferry out of Cruz Bay. The 4 o'clock trip will be cutting it very close. You can arrange with your cab driver on St. John to pick you up at a certain time, so you can be sure to make it back to the ferry on time. Finding a cab at Red Hook back to the ship won't be a problem.