If using dried beans, rinse and soak them overnight. Drain the beans before cooking. If using canned beans, simply drain and rinse them under cold water.
In a large pot or Dutch oven, heat olive oil over medium heat. Add the diced onion and green bell pepper, cooking until softened, about 5-7 minutes.
Add the minced garlic, ground cumin, oregano, and bay leaf. Stir and cook for another minute, allowing the spices to release their aroma.
If using ham or pork, add it to the pot and cook until browned. If not, skip this step.
Add the beans to the pot along with the water (or broth). Bring to a boil, then reduce the heat to low. Cover the pot and simmer for about 1 to 1.5 hours (if using dried beans), or 30 minutes (if using canned beans), until the beans are tender and the flavors have melded together.
Once the beans are cooked, add the vinegar, salt, and black pepper. Stir and adjust the seasoning to taste.
Remove the bay leaf and discard it. Serve the beans hot, garnished with fresh cilantro if desired.