That looks a lot to me like one of the Solanum nigrum ("black nightshade") varieties -- see the "Solanum nigrum complex" paragraph under "Taxonomy" in the Wikipedia article.
I'm not sure where you're from, but they grow as weeds all over North America, as well as -- as far as I know -- most of the rest of the world. They are not tomatoes, and most of these varieties are very dangerous.*
The leaves are smooth and kite-shaped with wavy margins and prominent veins. The berries are clustered and spherical, 1/4" diameter or a bit more at full growth, and turn from green to shiny black as they ripen. The flowers are white and five-petaled, with prominent yellow "beaks" in the center (technically, anthers) . (Personally, I think they're fairly handsome plants.)
It is related to the tomato, as well as several other food plants -- eggplants, capiscums, and potatoes. This accounts for the vague similarites one can see in the fruit and the leaf structures. They are all members of Solanaceae, the "nightshade family".
Some parts of different varieties of this genus and species are reported to have different degrees of edibility, depending on you, the plant, the ripeness of the berries, how you cook it, the day of the week, and whether your car is red.
Please don't eat any part of this plant unless you get a much better identification from an actual botanist or someone who can see the plant first-hand and is verifiably an expert.**
*Among non-mushrooms, poisonous nightshades are probably second only to the poisonous hemlocks ("poison hemlock" and the "water hemlock" genus) in terms of deadliness.
**Actually, that goes for any wild plant. Most aren't poisonous, and most of the poisonous ones aren't automatically deadly, but why make yourself sick for curiousity when there's plenty of books you can check first? Many of the poisonous wild ones are closely related to our food plants -- like this one, and various members of the pea family.