Hogwarts portraits are able to talk and move around from picture to picture. They behave like their subjects. However, the degree to which they can interact with the people looking at them depends not on the skill of the painter, but on the power of the witch or wizard painted.
When a magical portrait is taken, the witch or wizard artist will naturally use enchantments to ensure that the painting will be able to move in the usual way. The portrait will be able to use some of the subject’s favourite phrases and imitate their general demeanour. Thus, Sir Cadogan’s portrait is forever challenging people to a fight, falling off its horse and behaving in a fairly unbalanced way, which is how the subject appeared to the poor wizard who had to paint him, while the portrait of the Fat Lady continues to indulge her love of good food, drink and tip-top security long after her living model passed away.
However, neither of these portraits would be capable of having a particularly in-depth discussion about more complex aspects of their lives: they are literally and metaphorically two-dimensional. They are only representations of the living subjects as seen by the artist.
Some magical portraits are capable of considerably more interaction with the living world. Traditionally, a headmaster or headmistress is painted before their death. Once the portrait is completed, the headmaster or headmistress in question keeps it under lock and key, regularly visiting it in its cupboard (if so desired) to teach it to act and behave exactly like themselves, and imparting all kinds of useful memories and pieces of knowledge that may then be shared through the centuries with their successors in office.
Pottermore, Hogwarts Portraits
The main point we can conclude from this is that a painting can indeed learn after it is painted. Headmasters or Headmistresses teach their portrait valuable knowledge before their death. I think it is safe to presume that this type of learning is only present in Portraits of real subjects that are created whilst they are alive.
Though it is possible that Phineas Nigellus is actually only repeating information, much like in real life we can repeat information without actually learning it or learning how to use it. For instance the things he has 'learned'/observed over centuries past hasn't changed the way he thinks of muggle borns or any of his core values.
I believe that they can indeed respond to any question or stimuli and respond with any knowledge they have had imparted on them, whether or not this knowledge changes is subject to opinion.
Also key to note is that the capability of the painting is based on the power of the subject not the skill of the painter. So the Dumbledore portrait is likely the most sophisticated painting in the Heads office.
We get this quote from Pottermore in the Ghosts section:
Having chosen a feeble simulacrum of mortal life, ghosts are limited in what they can experience. No physical pleasure remains to them, and their knowledge and outlook remains at the level it had attained during life, so that old resentments (for instance, at having an incompletely severed neck) continue to rankle after several centuries.
Notice the part about their knowledge and outlook remaining at the same level. No let's look at a quote from Edinburgh Book Festival, Sunday, August 15, 2004 by JKR
Q: All the paintings we have seen at Hogwarts are of dead people. They seem to be living through their portraits. How is this so? If there was a painting of Harry’s parents, would he be able to obtain advice from them?
JKR: ... They are all of dead people; they are not as fully realised as ghosts, as you have probably noticed. The place where you see them really talk is in Dumbledore’s office, primarily; the idea is that the previous headmasters and headmistresses leave behind a faint imprint of themselves. They leave their aura, almost, in the office and they can give some counsel to the present occupant, but it is not like being a ghost. They repeat catchphrases, almost. The portrait of Sirius’ mother is not a very 3D personality; she is not very fully realised. She repeats catchphrases that she had when she was alive. If Harry had a portrait of his parents it would not help him a great deal. ...
So we know that portraits are not as full realised as ghosts, and we also know that ghosts cannot increase the level of knowledge attained during life. Which leads me to believe that portraits are also unable to increase their knowledge. However the term 'knowledge' is subjective they could indeed learn new information but it may not form part of their knowledge. It's confusing, but it also makes sense, think of it like having two lists, a knowledge list and an information list. You can act on your Knowledge and it makes up the basis of how you respond and your general demeanor, you can however repeat information as well just once gathered it will not affect the how you act or behave.
For instance we know the ghosts learn the names of the students, which could be seen as increasing their knowledge but really this is just increasing their information. Their knowledge at least i think from JKs point of view is what makes them respond the way they do and how they do and forms their fundamental character basis.
Let's say the information is associated with Harry and it's that Harry is married, Dumbledore's portrait will know(knowledge) about marriage, kids and all that stuff. He's just got new information though that Harry is now married, so he can impart wisdom and advice and personal experience(from his knowledge) and the next time Harry visits he can ask about the marriage (from his information) and store information like it's 'it's going well, we have a child named Albus now'.