Presoak beans overnight or for a minimum of 3 hours in a large container with enough water to generously cover.
Drain water, transfer beans to a large stockpot, and cover with 5 cups of fresh water. Bring to a boil over high heat. Reduce the heat to medium, add the ham or bacon pieces, partially cover, and cook for 1 hour, stirring occasionally. Add 1 cup of water and continue cooking for 30 to 35 minutes.
Meanwhile, make a sofrito: In a food processor or blender, combine garlic, bell pepper, cilantro, and half of the onion and process to a coarse paste.
In a small skillet, heat the oil. Add the sofrito mixture, and cook for 1 minute. Add the tomato paste, salt, black pepper, tomato, vinegar, and remaining onion to the beans and cook for 5 minutes. Add the rice and cook uncovered for 10 minutes, stirring occasionally to prevent sticking.
Reduce the heat to low, cover, and cook for another 15 to 20 minutes. Use a large spoon to separate the rice and bean mixture from the Side dish of the pot (do not stir any further or the mixture will break up and take on a gluey consistency). The dish is done when the liquid has been absorbed and the rice is fluffy.