First of all, Shakespeare has Hamlet announce the fact that he is going to be acting strange and putting on an "antic disposition". So, he "announces" his madness before he starts acting mad. That is one major difference here; Ophelia doesn't announce to the audience that she's just had enough so she is going to go insane. Her insanity is real, and Hamlet's isn't.
As for presentation, Ophelia is rambling nursery songs, snippets of logical commentary, talk of flowers, and nonsense, all mixed up into a huge jumble of confusing dialogue. She drifts from person to person, her stream of thought is not coherent, there is no point to it, and it isn't directed at one particular thing or person. The closest that Hamlet gets to acting like this is when he is speaking to Polonius; however, Hamlet is more cohesive. His point is that old men are fools; he wants Polonius to feel his foolishness. Later, another time Hamlet comes close to talking similar nonsense as Ophelia is when they are questioning him about where he has put the body of Polonius. He does say bizarre things, but they make perfect sense, and the entire point is to throw them off guard, to act like he is mad so as to not receive the blame for the murder, and to point out how great men (even men like the murderous king) someday only end up in the guts of worms. It is deliberate, planned, and purposeful. Ophelia's rambling is not. At most, it reflects her confusion and despair. Hamlet's is to mock others and serve his own purposes. Then, we have the added clarity that his soliloquys provide; in his speeches to himself, he is obviously lucid, he is rational, he is in the present, worrying about issues and planning his next step. We see no such lucidity from Ophelia; if Shakespeare wanted her madness to be feigned, like Hamlet's he probably would have thrown her a soliloquy to prove her sound mind.
So, in motive, purpose and strategy, their ramblings are very different, and, Hamlet shows his clear mind in moments alone. Those are the key differences in the presentations of madness in Hamlet and Ophelia. It's an interesting question; I hope that helped!