Four hours from after you claim your luggage would be fine. If you're talking about 4 hours after you dock, probably not. Miami is about 35 miles south of Ft. Lauderdale. It's not the distance, it's the traffic. On a Sunday morning, traffic will be lighter than on a Saturday morning. If traffic is moving well, then you can make it in about 45 minutes.
The ships usually dock between 6-7 am. Then they have to be cleared by Customs and Immigration. They usually start calling self-assist debarks around 7:30am. Then they will start calling the colors for debarkation. (They usually give you colored tags depending on your flight time). You'll probably be off the ship and through customs by 9am. Then you'd have to get a cab and go to Ft. Lauderdale, which would put you there around 10am. This is IF everything goes picture perfect. I wouldn't advise booking a return flight out of Ft. Lauderdale before noon, just to be safe.