I think the name of the bacteria you are looking for here is rhizobia. Rhizobia live in the soil and convert nitrogen. They live in the root nodules of legumes. The legume plant and the rhizobia live in harmony and help each other out. The rhizobia has an enzyme system that reduces the amount of nitrogen to the plant and in return the plant furnishes all of the nutrients that the bacteria needs.
The rhizobia is only able to fix the nitrogen in the soil if it is fixated to the legume. They are able to survive as a free living organism but in this way they cannot convert nitrogen. When they are free living they feed on other dead organisms.