It's been quite a while since I've programmed a robot, but using only the sonic sensor does make it a bit more challenging. Also, not knowing anything else about the robot you've built (it's size, other sensors & their location, the ball grabbing mechanism, etc.) it further complicates any possible advice.
That being said, the only solution I could think of would be to use the opening/doorway to the room as a reference point for the robot. The sensor should be able to locate it since it's "open", and the robot sent towards it. The line on the ramp leads me to believe your robot has a color sensor for line following, therefore should be able to detect the line at the doorway once it arrives. This will also allow the robot to "true" its location, which would allow rotating "x" degrees to have you pointing directly at the drop-off point. Then straight forward and (?) because I have no idea how your robot even picks the balls up or drops them.
My other solution would be to have a mechanical release lever for the ball. The lever would be positioned so only the low wall of the triangle could push it. This would be a much more simple solution in theory.