How to assign Human Task Actors Dynamically

I have a human task that should be assigned to group A if certain condition is met or should be assigned to group B if another condition is met.

How to assign a task to a group dynamically based on a condition?