Its very possible, but your plan depends on the ferry schedules (most of the boats are jet boats, not hydrofoils). As a general rule, the faster jet boats take about 50 min from Naples to Capri, about 20 min from Capri to Sorrento, and about 35 min from Sorrento to Naples. But it can vary depending on the type of boat. You need to do your homework on-line. But, the key to this kind of trip (we do crazier stuff all the time) is that you cannot make your final decision until you actually get to Naples. When you walk over to the ferry pier (less than a 10 min stroll from the cruise ship) you need to carefully check all the schedules. Once you get to Capri (and before you even leave the Marina Grande area) you should again check the schedules from Capri over to Sorrento. If it would turn out that you cannot find a good scheduled connection from Sorrento to Naples (these do not run as often) than you can still go to Sorrento and than simply take the Circumvesuviania train from Sorrento (they have about 2 an hour) to Naples where its a 5 min taxi ride (or a 25 min walk) to the cruise port. The trick to these kind of days is to keep your flexibility and know your options.