To get these shots, I use two lights for the black background and one for the white background. For the black background, I have a light 90° left and 90° right of the subject with about a 12" gap between the two.
Keeping the lights really close to the subject means you get a lot of light for the subject, a small aperture for lots of detail, and really quick light falloff for the background to remain completely black. If you don't have two lights, you can use a reflector instead.
Place a dark background 2-3 feet behind the subject. I use a black sheet, but if you don't have one, use a t-shirt or anything dark, and the light fall off should make it completely black.
For the white background, I used one light with a soft box pointed straight at the camera and metered for the light, once you have your camera at your desired setting place with the flower around 2-3 inches in front of the light. This method only works well with certain flowers, and you need flowers that are quite translucent.
Finally, not everyone has soft boxes, but if you search on the internet for homemade soft boxes there are plenty of tutorials how to make them out of a cardboard boxes and white paper. The important thing is to experiment and have fun.