Can the brake levers be moved from the side to the top of the handlebar? My bicycle currently looks like this:


Can I move the brake levers from the side to the front, so it looks like this?



How do I go about it, and is it good idea? I'm new to riding this kind of a bicycle and I feel very uncomfortable leaning so far to the front to hit at the brakes!
Not really. The levers in the second picture are commonly called "interrupter" levers, and are usually used in addition to the levers you've already got.

I think you'd find that if you simply tried to relocate your existing levers, they wouldn't fit against the tops of the bars very well, and the way the levers are curved would cause them to bump into the handlebars before you had fully depressed them.

You could replace your current levers with interrupters (at least some interrupters are designed so they can be used alone). I'd advise against that: riding from the "tops" of the handlebars can make handling a little dicey, and this would lock you into braking from a less-controlled position. You can ride on the brake hoods or the "ramps" just above them and still apply a fair amount of leverage to the brake levers while being in a position that's reasonably comfortable and controlled. 

If your bike is the one shown in the top picture, you can also raise your stem. I think that if you give the forward position a chance, you'll adapt to it. If not, you can replace your handlebars with flat bars (you'd need new brake levers for that as well).